var color = ["#EEA622",'#00C634','#1890FF',"#00CCD2", "#FABF32",  "#FABF32","#B3C9D5", "#1AAFDE", "#07B345", "#FF8300"];
export function lineBar2ChartFun(data, chartsId) {
  let seriesData = (data.yData || []).map((item, index) => {
    if(item.type == 'line') {
        return {
            name: item.name || '',
            type: 'line',
            symbolSize: 2,
            // smooth: true,
            litemStyle: {
              color: "red",
              borderColor: "#00FFF686",
              borderWidth: 2,
           },
           label: {
            show: data.labelflag === false ? false :true,
            position: "top",
            textStyle: {
               fontSize: 12,
               color: "#FFFFFFFF",
            },
           },
            data: item.value || [],
            itemStyle: {
              color: item.color || color[index],
            }
        };
    } else {
        return {
            name: item.name || '',
            type: 'bar',
            barWidth: data.barWidth || '11px',
            itemStyle: {
              color: item.color,
			        barBorderRadius: [10, 10, 0, 0] // 只在顶部设置圆角，底部保持直角
            },
            data: item.value || [],
        }
    }

  });
  let lineAreaChartsOption = {
    tooltip: {
      trigger: "axis",
    },
    grid: {
      left: '4%',
      right: '0%',
      bottom: '2%',
      top: data.gridtop ? data.gridtop : '16%',
      containLabel: true,
    },
    //图例
    legend: {
      show: data.legendShow === false ? data.legendShow : true,
      left: data.legendLeft ? data.legendLeft : 'center',
      top: data.legendTop ? data.legendTop : 'top',
      textStyle: {
          fontSize: data.fontSize ? data.fontSize : 12,
          color: "#C9DFFF",
      },
	  // icon: 'circle',
      itemWidth: 10,
      itemHeight: 7,
      itemGap: data.itemGap ? data.itemGap : 60,
    },
    xAxis: {
      type: 'category',
      data: data.xData,
      axisLine: {
        show: true,
        lineStyle: {
          type: "dotted",
          color: "rgba(139,209,182,0.38)",
          type: [6, 3],
          dashOffset: 1,
        },
      },
      axisTick: {
        show: false,
      },
      axisLabel: {
        show: true,
        textStyle: {
          color: '#C9DFFF', //X轴文字颜色
          fontSize: 11
        },
      },
    },
    yAxis:[
        {
            type: "value",
            // name: "个",
            splitLine: {
              show: true,
              lineStyle: {
                type: "dotted",
                color: "rgba(139,209,182,0.38)",
                type: [6, 3],
                dashOffset: 1,
              },
            },
            axisLabel: {
              padding: [0, 5, 0, 0],
              fontSize: 11,
              textStyle: {
                color: "#B5C5D4FF",
                fontFamily: "Microsoft YaHei",
              },
            },
          }
    ],
    series: seriesData,
  };
  return lineAreaChartsOption
}
